# coding=utf-8
from common.exe_web_settings.model import ExeWebSettings
from common.utils.db import list_object
from common.utils.decorator import sql_wrapper


@sql_wrapper
def get_exe_active_settings(bank ):
    settings = ExeWebSettings.query.filter(ExeWebSettings.bank == bank).filter(ExeWebSettings.active == 1).first()
    if settings:
        return {
            "Id": settings.id,
            "Bank": settings.bank,
            "Settings": settings.settings,
            "Active": settings.active,
            "CreateDate": settings.create_date
        }
        return settings
    else:
        return {}

def get_settings(q):
    return list_object(q, ExeWebSettings)
